package models.dataClasses;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;


class Encrypt {
	
	public static String encryptString(StringWriter strIn)
	{
		StringBuffer strBuff = strIn.getBuffer();
		for(int i=0 ; i<strBuff.length(); ++i)
		{
			
			int carWithSalt = (int)strBuff.charAt(i) /*+ 0x01*/;
			strBuff.setCharAt(i, (char)carWithSalt);
		}
		
		return strIn.toString();
	}
	
	public static String decryptString(InputStreamReader is, StringWriter strIn)
	{
		StringBuffer strBuff = strIn.getBuffer();
		int car;
		try {
			car = is.read();
			while(car != -1)
			{
				
				int carWithoutSalt = car ;//- 0x01;
				Character c = new Character((char)carWithoutSalt);
				strBuff.append(c.charValue());
				System.out.print(c);
				car = is.read();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return strIn.toString();
	}

}
